﻿Imports DTO
Public Class TheLoai_DAO

#Region "Load danh sách thể loại"
    Public Shared Function LoadTheLoai() As DataTable
        Dim sql As String = "select * from TheLoai"
        Return DataProvider.ExcuteReader(sql)
    End Function
#End Region

#Region "Thêm thể loại mới"
    Public Shared Function ThemTheLoai(ByVal tl As TheLoai_DTO) As Integer
        Dim sql As String = String.Format("insert into TheLoai(TenTheLoai) values('{0}')", tl.Ten)
        Dim flag As Integer = DataProvider.ExcuteNonQuery(sql)
        Return flag
    End Function
#End Region

#Region "Sửa thể loại"
    Public Shared Function SuaTheLoai(ByVal tl As TheLoai_DTO) As Integer
        Dim sql As String = String.Format("update TheLoai set TenTheLoai = '{0}' where MaTheLoai = {1}", tl.Ten, tl.Ma)
        Dim flag As Integer = DataProvider.ExcuteNonQuery(sql)
        Return flag
    End Function
#End Region

End Class
